package com.docker.chy.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.docker.common.annotation.Log;
import com.docker.common.core.controller.BaseController;
import com.docker.common.core.domain.AjaxResult;
import com.docker.common.enums.BusinessType;
import com.docker.chy.domain.DoctorRegistationcost;
import com.docker.chy.service.IDoctorRegistationcostService;
import com.docker.common.utils.poi.ExcelUtil;
import com.docker.common.core.page.TableDataInfo;

/**
 * 挂号费Controller
 * 
 * @author ruoyi
 * @date 2025-04-10
 */
@RestController
@RequestMapping("/chy/registationcost")
public class DoctorRegistationcostController extends BaseController
{
    @Autowired
    private IDoctorRegistationcostService doctorRegistationcostService;

    /**
     * 查询挂号费列表
     */
    @PreAuthorize("@ss.hasPermi('chy:registationcost:list')")
    @GetMapping("/list")
    public TableDataInfo list(DoctorRegistationcost doctorRegistationcost)
    {
        startPage();
        List<DoctorRegistationcost> list = doctorRegistationcostService.selectDoctorRegistationcostList(doctorRegistationcost);
        return getDataTable(list);
    }

    /**
     * 导出挂号费列表
     */
    @PreAuthorize("@ss.hasPermi('chy:registationcost:export')")
    @Log(title = "挂号费", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DoctorRegistationcost doctorRegistationcost)
    {
        List<DoctorRegistationcost> list = doctorRegistationcostService.selectDoctorRegistationcostList(doctorRegistationcost);
        ExcelUtil<DoctorRegistationcost> util = new ExcelUtil<DoctorRegistationcost>(DoctorRegistationcost.class);
        util.exportExcel(response, list, "挂号费数据");
    }

    /**
     * 获取挂号费详细信息
     */
    @PreAuthorize("@ss.hasPermi('chy:registationcost:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(doctorRegistationcostService.selectDoctorRegistationcostById(id));
    }

    /**
     * 新增挂号费
     */
    @PreAuthorize("@ss.hasPermi('chy:registationcost:add')")
    @Log(title = "挂号费", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DoctorRegistationcost doctorRegistationcost)
    {
        return toAjax(doctorRegistationcostService.insertDoctorRegistationcost(doctorRegistationcost));
    }

    /**
     * 修改挂号费
     */
    @PreAuthorize("@ss.hasPermi('chy:registationcost:edit')")
    @Log(title = "挂号费", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DoctorRegistationcost doctorRegistationcost)
    {
        return toAjax(doctorRegistationcostService.updateDoctorRegistationcost(doctorRegistationcost));
    }

    /**
     * 删除挂号费
     */
    @PreAuthorize("@ss.hasPermi('chy:registationcost:remove')")
    @Log(title = "挂号费", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(doctorRegistationcostService.deleteDoctorRegistationcostByIds(ids));
    }
}
